using System;
using System.Data.Common;
using System.Reflection;

namespace SunRiseSoft.Library.DataAccess
{

    public class DataInstrumentation
    {

        protected DataInstrumentation()
        {

        }

        public virtual void ConnectionOpened(DbConnection connection)
        {

        }

        public virtual void ConnectionFailed(DbConnection connection, Exception ex)
        {

        }

        public virtual void CommandExecuted(DbCommand command)
        {

        }

        public virtual void CommandFailed(DbCommand command, Exception ex)
        {

        }

        public static DataInstrumentation Create(string connectionName)
        {
            return new DataInstrumentation();

            //if (string.IsNullOrEmpty(connectionName))
            //{
            //    return new DataInstrumentation();
            //}
            //if (ConfigurationManager.DataInstrumentation(connectionName) == null)
            //{
            //    return new DataInstrumentation();
            //}
            //string assemblyQualifiedName = ConfigurationManager.DataInstrumentation(connectionName).Type;
            //Type typeClass = Type.GetType(assemblyQualifiedName);
            //if (typeClass == null)
            //{
            //    return new DataInstrumentation();
            //}
            //object instance = Activator.CreateInstance(typeClass);
            //if (instance == null)
            //{
            //    return new DataInstrumentation();
            //}
            //return (DataInstrumentation)instance;
        }

    }

}
